home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
Dev
/
Oberon
/
source
/
amiga
/
Gadgets.mod
< prev
next >
Wrap
Text File
|
1995-06-29
|
6KB
|
211 lines
(*************************************************************************
$RCSfile: Gadgets.mod $
Description: Interface to the colorwheel, tapedeck and gradientslider
gadgets.
Created by: fjc (Frank Copeland)
$Revision: 3.7 $
$Author: fjc $
$Date: 1995/06/04 23:13:14 $
Includes Release 40.15
(C) Copyright 1992-1993 Commodore-Amiga Inc.
All Rights Reserved
Oberon-A Interface Copyright © 1994-1995, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
*************************************************************************)
<* STANDARD- *>
MODULE [2] Gadgets;
IMPORT SYS := SYSTEM, Kernel, e := Exec, u := Utility;
(* !!! ATTENTION !!!
* You have to call OpenColorWheel() and check it's result before
* using any of the colorwheel's procedures. The colorwheel is not
* opened automatically to save memory.
*)
(*
** $VER: gradientslider.h 39.1 (18.6.92)
**
** Definitions for the gradientslider BOOPSI class
*)
(************************************************************************)
CONST
gradDummy * = u.user + 005000000H;
gradMaxVal * = gradDummy+1; (* max value of slider *)
gradCurVal * = gradDummy+2; (* current value of slider *)
gradSkipVal * = gradDummy+3; (* "body click" move amount *)
gradKnobPixels * = gradDummy+4; (* size of knob in pixels *)
gradPenArray * = gradDummy+5; (* pen colors *)
(************************************************************************)
(*
** $VER: tapedeck.h 40.0 (12.3.93)
**
** Definitions for the tapedeck BOOPSI class
*)
(************************************************************************)
CONST
tdeckDummy * = u.user + 005000000H;
tdeckMode * = tdeckDummy + 1;
tdeckPaused * = tdeckDummy + 2;
tdeckTape * = tdeckDummy + 3;
(* (BOOL) Indicate whether tapedeck or animation controls. Defaults
* to FALSE. *)
tdeckFrames * = tdeckDummy + 11;
(* (LONG) Number of frames in animation. Only valid when using
* animation controls. *)
tdeckCurrentframe * = tdeckDummy + 12;
(* (LONG) Current frame. Only valid when using animation controls. *)
(************************************************************************)
CONST
(* Possible values for tdeckMode *)
butRewind * = 0;
butPlay * = 1;
butForward * = 2;
butStop * = 3;
butPause * = 4;
butBegin * = 5;
butFrame * = 6;
butEnd * = 7;
(***********************************************************************)
(*
** $VER: colorwheel.h 39.2 (22.6.92)
**
** Definitions for the colorwheel BOOPSI class
*)
(***********************************************************************)
TYPE
(* For use with the WHEEL_HSB tag *)
ColorWheelHSBPtr * = POINTER TO ColorWheelHSB;
ColorWheelHSB * = RECORD
hue * : e.ULONG;
saturation * : e.ULONG;
brightness * : e.ULONG;
END;
(* For use with the WHEEL_RGB tag *)
ColorWheelRGBPtr * = POINTER TO ColorWheelRGB;
ColorWheelRGB * = RECORD
red * : e.ULONG;
green * : e.ULONG;
blue * : e.ULONG;
END;
(***********************************************************************)
CONST
wheelDummy * = u.user + 004000000H;
wheelHue * = wheelDummy+1; (* set/get Hue *)
wheelSaturation * = wheelDummy+2; (* set/get Saturation *)
wheelBrightness * = wheelDummy+3; (* set/get Brightness *)
wheelHSB * = wheelDummy+4; (* set/get ColorWheelHSB *)
wheelRed * = wheelDummy+5; (* set/get Red *)
wheelGreen * = wheelDummy+6; (* set/get Green *)
wheelBlue * = wheelDummy+7; (* set/get Blue *)
wheelRGB * = wheelDummy+8; (* set/get ColorWheelRGB *)
wheelScreen * = wheelDummy+9; (* init screen/enviroment *)
wheelAbbrv * = wheelDummy+10; (* "GCBMRY" if English *)
wheelDonation * = wheelDummy+11; (* colors donated by app *)
wheelBevelBox * = wheelDummy+12; (* inside a bevel box *)
wheelGradientSlider * = wheelDummy+13; (* attached gradient slider *)
wheelMaxPens * = wheelDummy+14; (* max # of pens to allocate *)
(*-- Library Base variable --------------------------------------------*)
CONST
colorWheelName * = "colorwheel.library";
VAR
cwBase* : e.LibraryPtr;
cwOpenCount : LONGINT; (* OpenLib() counter *)
(*-- Library Functions ------------------------------------------------*)
(*
** $VER: colorwheel_protos.h 39.1 (21.7.92)
*)
(*--- functions in V39 or higher (Release 3) ---*)
(* Public entries *)
PROCEDURE ConvertHSBToRGB* [cwBase,-30]
( VAR hsb [8] : ColorWheelHSB;
VAR rgb [9] : ColorWheelRGB );
PROCEDURE ConvertRGBToHSB* [cwBase,-36]
( VAR rgb [8] : ColorWheelRGB;
VAR hsb [9] : ColorWheelHSB );
(*-- Library Base variable --------------------------------------------*)
<*$ LongVars- *>
(*-----------------------------------*)
PROCEDURE* [0] CloseCW (VAR rc : LONGINT);
BEGIN (* CloseCW *)
IF cwBase # NIL THEN e.CloseLibrary (cwBase) END
END CloseCW;
PROCEDURE [0] OpenColorWheel * (): BOOLEAN;
BEGIN
IF cwOpenCount = 0 THEN (* not opened *)
cwBase := e.OpenLibrary(colorWheelName,39);
END;
IF cwBase # NIL THEN
INC(cwOpenCount);
RETURN TRUE;
END;
RETURN FALSE;
END OpenColorWheel;
PROCEDURE [0] CloseColorWheel * ();
BEGIN
IF cwOpenCount > 0 THEN
DEC(cwOpenCount);
IF cwOpenCount = 0 THEN
e.CloseLibrary(cwBase); cwBase := NIL;
END;
END;
END CloseColorWheel;
BEGIN
cwOpenCount := 0; cwBase := NIL;
Kernel.SetCleanup (CloseCW)
END Gadgets.